package com.linsir.auth.modules.oauth.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.linsir.auth.model.security.CustomGrantedAuthority;
import com.linsir.core.entity.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.security.core.userdetails.UserDetails;

import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Collection;

/**
 * <p>
 * 基础用户信息表
 * </p>
 *
 * @author vains
 */
@EqualsAndHashCode(callSuper = true)
@Data
@JsonSerialize
@TableName("user_ext_oauth2_basic_user")
@JsonIgnoreProperties(ignoreUnknown = true)
public class Oauth2BasicUser extends BaseEntity implements UserDetails, Serializable {

    /**
     * 用户名、昵称
     */
    private String username;


    /**
     * 账号
     */
    private String account;

    /**
     * 密码
     */
    private String password;

    /**
     * 手机号
     */
    private String mobile;

    /**
     * 邮箱
     */
    private String email;

    /**
     * 用户来源
     */
    private String sourceFrom;


    @TableField(exist = false)
    private Collection<CustomGrantedAuthority> authorities;


    /*过期时间*/
    private String timeExpiration;

    private boolean isAccountNonExpired;

    private boolean isAccountNonLocked;

    private boolean isCredentialsNonExpired;

    private boolean isEnabled;


}
